home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / glass / glass.lha / GLASS / tmc / lltest.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-11-06  |  1.5 KB  |  52 lines

  1. /* 
  2.    Copyright (C) 1990 C van Reewijk, email: dutentb.uucp!reeuwijk
  3.  
  4. This file is part of GLASS.
  5.  
  6. GLASS is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 1, or (at your option)
  9. any later version.
  10.  
  11. GLASS is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with GLASS; see the file COPYING.  If not, write to
  18. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  19.  
  20. /* file: lltest.c
  21.  
  22.    Test of 'll' modules: read a file for a given datastructure
  23.    and write it out again in pretty-printed format.
  24.  */
  25.  
  26. #include <stdio.h>
  27. #include <tmc.h>
  28.  
  29. #include "llcode.h"
  30.  
  31. int main(){
  32.     toplevel_list ds;
  33.     toplevel_list dscopy;
  34.  
  35.     if( fscan_toplevel_list( stdin, &ds ) ){
  36.     fprintf( stderr, "Read error: %s\n", tmerrmsg );
  37.     }
  38.     dscopy = rdup_toplevel_list( ds );
  39.     if( cmp_toplevel_list( ds, dscopy ) != 0 ){
  40.     fprintf( stderr, "Strange, copy not equal to original\n" );
  41.     exit( 1 );
  42.     }
  43.     ds = app_toplevel_list( ds, dscopy );
  44.     fprint_toplevel_list( stdout, ds );
  45.     setprint( stdout, 4, 80 );
  46.     print_toplevel_list( ds );
  47.     rfre_toplevel_list( ds );
  48.     stat_ds( stderr );
  49.     exit( 0 );
  50.     return( 0 );
  51. }
  52.